package Chuong07;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.Serializable;

public class MaTran implements Serializable{
	
	int nDong;
	int nCot;
	int[][] A;
	
	public MaTran(){
		this.nDong = 0;
		this.nCot = 0;
		this.A =  new int[nDong][nCot];
	}
	
	public MaTran(int m, int n){
		this.nDong = m;
		this.nCot = n;
		this.A =  new int[nDong][nCot];
	}
	
	public MaTran(int[][]a, int m, int n){
		this.nDong = m;
		this.nCot = n;
		this.A =  a;
	}
	
	public String Get(){
		String resuft = nDong + "\n" + nCot + "\n";
		for(int i = 0; i < nDong; i++){
			for(int j = 0; j < nCot; j++){
				resuft += A[i][j] + "\t";
			}
			resuft += "\n";
		}
		return resuft;
	}
	
	public void Set(BufferedReader in){
		try {
			A = new int[nDong][nCot];
			for(int i = 0; i < nDong; i++){
				for(int j = 0; j < nCot; j++){
					System.out.print("A[" + (i + 1) + "][" + (j + 1) + "] = "); 
					this.A[i][j] = Integer.parseInt(in.readLine());
				}
			}
			
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
